const http = require("http");
const url = require("url");

http
  .createServer((req, res) => {
    const urlObj = url.parse(req.url, true);
    switch (urlObj.pathname) {
      case "/api/aaa":
        res.end(
          `${urlObj.query.cb}(${JSON.stringify({
            name: "seupyy",
            age: 100,
          })})`
        );
        break;
      default:
        res.end("404");
    }
  })
  .listen(5000);
